﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AAA.Meta.UIModel
{
    public class TextModel
    {
        private string _strText;

        public string Text
        {
            get { return _strText; }
            set { _strText = value; }
        }

        private string _strSplit;

        public string Split
        {
            get { return _strSplit; }
            set { _strSplit = value; }
        }

        public string[] ToValues()
        {
            if (Split != null)
                return Text.Split(Split.ToCharArray());

            return new string[] { Text };
        }

        public void SetValues(string[] strValues)
        {
            SetValues(strValues, Split == null ? "~" : Split);
        }

        public void SetValues(string[] strValues, string strSplit)
        {
            Text = "";

            foreach (string strValue in strValues)
                Text += strSplit + strValue;

            if (Text.Length > 0)
                Text = Text.Substring(strSplit.Length);
        }
    }
}
